% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/table_xls_format.R
\name{table_xls_format}
\alias{table_xls_format}
\title{Format EJAM tabular outputs for saving as Excel spreadsheet}
\usage{
table_xls_format(
  overall,
  eachsite,
  longnames = NULL,
  formatted = NULL,
  bybg = NULL,
  plot_distance_by_group = FALSE,
  summary_plot = NULL,
  plotlatest = FALSE,
  plotfilename = NULL,
  mapadd = FALSE,
  community_reportadd = FALSE,
  report_map = NULL,
  community_image = NULL,
  ok2plot = TRUE,
  analysis_title = "EJAM analysis",
  buffer_desc = "Selected Locations",
  radius_or_buffer_in_miles = NULL,
  radius_or_buffer_description =
    "Miles radius of circular buffer (or distance used if buffering around polygons)",
  notes = NULL,
  custom_tab = NULL,
  custom_tab_name = "other",
  heatmap_colnames = NULL,
  heatmap_cuts = c(80, 90, 95),
  heatmap_colors = c("yellow", "orange", "red"),
  heatmap2_colnames = NULL,
  heatmap2_cuts = c(1.009, 2, 3),
  heatmap2_colors = c("yellow", "orange", "red"),
  hyperlink_colnames = c("EJScreen Report", "EJScreen Map", "ECHO report"),
  graycolnames = NULL,
  narrowcolnames = NULL,
  graycolor = "gray",
  narrow6 = 6,
  testing = FALSE,
  updateProgress = NULL,
  launchexcel = FALSE,
  saveas = NULL,
  ejscreen_ejam_caveat = NULL,
  ...
)
}
\arguments{
\item{overall}{table to save in one tab, from ejamit()$results_overall, EJAM analysis of indicators overall (one row),
but if entire output of ejamit() is passed as if it were overall, function figures out eachsite, etc.}

\item{eachsite}{table to save in one tab, from ejamit()$results_bysite, EJAM analysis site by site (one row per site)}

\item{longnames}{vector of indicator names to display in Excel table}

\item{formatted}{optional table to save in one tab, from ejamit()$results_overall, EJAM analysis overall in different format}

\item{bybg}{Optional large table of details of each block group that is only needed to analyze distances by group.}

\item{plot_distance_by_group}{logical, whether to try to add a plot of mean distance by group.
This requires that bybg be provided as a parameter input to this function.}

\item{summary_plot}{optional plot object passed from EJAM shiny app to save in 'Plot' sheet of Excel table}

\item{plotlatest}{optional logical. If TRUE, the most recently displayed plot (prior to this function being called) will be inserted into a tab called plot2}

\item{plotfilename}{the full path including name of .png file to insert}

\item{mapadd}{logical optional - try to include a map of the points}

\item{community_reportadd}{logical provided by shiny app to specify whether to include community report image}

\item{report_map}{leaflet map object passed from Shiny app to display in 'Map' sheet}

\item{community_image}{image of community report provided by shiny app to include in spreadsheet}

\item{ok2plot}{can set to FALSE to prevent plots from being attempted, while debugging}

\item{analysis_title}{optional title passed from Shiny app to 'Notes' sheet}

\item{buffer_desc}{optional description of buffer used in analysis, passed to 'Notes' sheet}

\item{radius_or_buffer_in_miles}{If provided, miles buffer distance (from polygon or from point if circular buffers)}

\item{radius_or_buffer_description}{optional text saying if distance is radius or polygon buffer, passed to 'Notes' sheet}

\item{notes}{Text of additional notes to put in the notes tab, optional vector of character elements pasted in as one line each.}

\item{custom_tab}{optional table to put in an extra tab}

\item{custom_tab_name}{optional name of optional custom_tab}

\item{heatmap_colnames}{optional vector of colnames to apply heatmap colors, defaults to percentiles}

\item{heatmap_cuts}{vector of values to separate heatmap colors, between 0-100 for percentiles}

\item{heatmap_colors}{vector of color names for heatmap bins, same length as
heatmap_cuts, where first color is for those >= 1st cutpoint, but <2d,
second color is for those >=2d cutpoint but <3d, etc.}

\item{heatmap2_colnames}{like heatmap_colnames but for ratios by default}

\item{heatmap2_cuts}{like heatmap_cuts but for ratios by default}

\item{heatmap2_colors}{like heatmap_colors but for ratios}

\item{hyperlink_colnames}{names of which to treat as URLs that should be hyperlinks}

\item{graycolnames}{which columns to deemphasize}

\item{narrowcolnames}{which column numbers to make narrow}

\item{graycolor}{color used to deemphasize some columns}

\item{narrow6}{how narrow}

\item{testing}{optional for testing only}

\item{updateProgress}{optional Shiny progress bar to update during formatting}

\item{launchexcel}{Set to TRUE to have this function launch Excel immediately, showing the final workbook created here.}

\item{saveas}{If not NULL, and a valid path with filename.xlsx is provided,
the workbook will be saved locally at that path and name. Warning: it will overwrite an existing file.}

\item{ejscreen_ejam_caveat}{optional text if you want to change this in the notes tab}

\item{...}{other params passed along to \code{\link[openxlsx:writeData]{openxlsx::writeData()}}}
}
\value{
a workbook, ready to be saved in spreadsheet format, with tabs like "Overall" and "Each Site"
}
\description{
Used by table_xls_from_ejam()
}
\details{
Already took and put here most or all of code from table_xls_format() or table_xls_format_api()
}
\examples{
\dontrun{
  table_xls_format(
    testoutput_ejamit_100pts_1miles$results_overall, 
    testoutput_ejamit_100pts_1miles$results_bysite,
    saveas =  "out1.xlsx")
 # can just pass the whole results of ejamit(), for convenience
 wb <- table_xls_format(testoutput_ejamit_100pts_1miles)
 openxlsx::saveWorkbook(wb, file = "out2.xlsx")
}

}
\seealso{
\code{\link[=table_xls_from_ejam]{table_xls_from_ejam()}}
}
\keyword{internal}
